//
//  CouponCommentsCell.m
//  OrderSeat
//
//  Created by 王威 on 13-11-27.
//  Copyright (c) 2013年 wangwei. All rights reserved.
//

#import "SimpleCommentsCell.h"
#import "UIImageView+WebCache.h"

@implementation SimpleCommentsCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _tableviewHeight = 40.0f;
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setContent:(NSDictionary*)dic
{
    NSString *touxiang = [dic objectForKey:@"touxiang"];
    
    if ([[NSNull null] isEqual:touxiang] || [touxiang isEqualToString:S_EMPTY]) {
        _photoImage.image = [UIImage imageNamed:@"user_avatar.png"];
    }
    else {
        [_photoImage setImageWithURL:[NSURL URLWithString:touxiang]];
    }
    
    _nameLabel.text = [dic objectForKey:@"huiyuan"];
    _contentLabel.text = [dic objectForKey:@"dianping"];
    _timeLabel.text = [dic objectForKey:@"add_time"];
    
    [_contentLabel autoLabelSize];
    
    self.height = _contentLabel.bottom_2;
}

- (CGFloat)getCellHeight:(NSDictionary*)dic
{
    [self setContent:dic];
    return self.height;
}

@end
